go to previous page   go to home page   go to next page

Answer:

The number of times each individual object has been used. (If this is not clear, look at the class definition again to see that the variable useCount is part of each object, and that each object has its own method incrementUse() which increments its own variable.)


Example main()

Here is a main() that shows these ideas:

class CheckingAccountTester
{
  public static void main( String[] args )
  {
    CheckingAccount bobsAccount  = new CheckingAccount( "999", "Bob", 100 );
    CheckingAccount jillsAccount = new CheckingAccount( "111", "Jill", 500 );

    bobsAccount.processCheck( 50 );
    System.out.println( bobsAccount.toString() );

    jillsAccount.processDeposit( 500 );
    jillsAccount.processCheck( 100 );
    jillsAccount.processCheck( 100 );
    jillsAccount.processDeposit( 100 );

    System.out.println( jillsAccount.toString() );
  }
}

QUESTION 14:

How may times has Bob's account been used?

How may times has Jill's account been used?